package com.jinmei.web.action;

import java.util.ArrayList;
import java.util.List;

import com.jinmei.model.Employee;
import com.jinmei.service.EmployeeService;
import com.jinmei.web.ContactDTO;

public class ContactInfoAction extends BaseAction{

	private static final long serialVersionUID = 1L;

	private EmployeeService employeeService;
	
	private List<ContactDTO> contactInfoResults;
	
	public String allcontacts() throws Exception{
		List<Employee> employees = employeeService.findAllEmployees();
		contactInfoResults = new ArrayList<ContactDTO>();
		for(Employee e : employees){
			ContactDTO dto = new ContactDTO();
			dto.setFId(e.getfId().toString());
			dto.setFEmail(e.getfEmail());
			dto.setFEnName(e.getfEnName());
			dto.setFFullName(e.getfFullName());
			dto.setFMobile(e.getfMobile());
			dto.setFName(e.getfName());
			dto.setFNick(e.getfNick());
			dto.setFNumber(e.getfNumber());
			dto.setFPMobile(e.getfPMobile());
			dto.setFSex(e.getfSex());
			dto.setFTel(e.getfTel());
			contactInfoResults.add(dto);
		}
		return SUCCESS;
	}
	
	public EmployeeService getEmployeeService() {
		return employeeService;
	}

	public void setEmployeeService(EmployeeService employeeService) {
		this.employeeService = employeeService;
	}

	public List<ContactDTO> getContactInfoResults() {
		return contactInfoResults;
	}

	public void setContactInfoResults(List<ContactDTO> contactInfoResults) {
		this.contactInfoResults = contactInfoResults;
	}

}
